//
//  CommonMicro.h
//  KurentoToolboxDemo
//
//  Created by 葛殿宏 on 16/3/19.
//  Copyright © 2016年 Telecom Italia S.p.A. All rights reserved.
//

#ifndef CommonMicro_h
#define CommonMicro_h

#ifdef __OBJC__
#import "UIView+Toast.h"
#import "UIColor+Hex.h"
#import <AVFoundation/AVFoundation.h>
#endif

#import "NIFLog.h"
#import "CommonUtil.h"
#import "NetAPIManager.h"
#import "UIImageView+WebCache.h"

//#define DEFAULTWSROOM @"https://172.16.208.216:8443/room"
//#define DEFAULTWSROOM @"wss://172.16.208.103:8443/room"
//#define DEFAULTWS @"wss://172.16.208.103:8443/"
#define DEFAULTWS @"wss://16.arenacloud.com/"

#define DEFAULTWSROOM [NSString stringWithFormat:@"%@room",DEFAULTWS]

//#define DEFAULTWSROOM @"https://172.16.208.103:8443/room"
//字体颜色
#define COLOR_FONT_RED   0xD54A45
#define COLOR_FONT_WHITE 0xFFFFFF
#define COLOR_FONT_LIGHTWHITE 0xEEEEEE
#define COLOR_FONT_DARKGRAY  0x555555
#define COLOR_FONT_GRAY  0x777777
#define COLOR_FONT_LIGHTGRAY  0x999999
#define COLOR_FONT_BLACK 0x000000

//背景颜色
#define COLOR_BG_GRAY      0xEDEDED
#define COLOR_BG_ALPHABLACK     0x88000000
#define COLOR_BG_ORANGE 0xf69e21
#define COLOR_BG_ALPHARED  0x88D54A45
#define COLOR_BG_LIGHTGRAY 0xEEEEEE
#define COLOR_BG_ALPHAWHITE 0x55FFFFFF
#define COLOR_BG_WHITE     0xFFFFFF
#define COLOR_BG_DARKGRAY     0xAFAEAE
#define COLOR_BG_RED       0xD54A45
#define COLOR_BG_BLUE      0x4586DA
#define COLOR_BG_CLEAR     0x00000000

#define RGB(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]
#define RGBA(r,g,b,x) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:x]
#define RGBHEXCOLOR(h)      [UIColor colorWithHexString:h]
#define RGBAHEXCOLOR(h,a)   [UIColor colorWithHexString:h withAlpha:a]
//rbg转UIColor(16进制)
#define RGB16(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define RGBA16(rgbaValue) [UIColor colorWithRed:((float)((rgbaValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbaValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbaValue & 0xFF))/255.0 alpha:((float)((rgbaValue & 0xFF000000) >> 24))/255.0]


#define FONT(x) ([UIFont systemFontOfSize:x])
#define IPHONE4ORIPHONE5 (SCREEN_WIGHT >= 320.0 - 0.01 && SCREEN_WIGHT <= 320.0+0.01)

#define SCREEN_WIGHT           [[UIScreen mainScreen] bounds].size.width
#define SCREEN_HEIGHT           [[UIScreen mainScreen] bounds].size.height
#define ISIPAD              (SCREEN_WIGHT > 414.0 && SCREEN_HEIGHT > 736.0)
#define Mutity3Scale(x)      ((SCREEN_WIGHT > 414.0 && SCREEN_HEIGHT > 736.0)? x : x/3.0)
#define Mutity2Scale(x)      ((SCREEN_WIGHT > 414.0 && SCREEN_HEIGHT > 736.0)? x : x/2.0)
#define Mutity1Scale(x)      ((SCREEN_WIGHT > 414.0 && SCREEN_HEIGHT > 736.0)? x : x/1.4)
#define Mutity1M5Scale(x)      ((SCREEN_WIGHT > 414.0 && SCREEN_HEIGHT > 736.0)? x : x/1.5)

#define NULL_OR_EMPTY(str) (str == nil || str.length == 0)

#define WeakObj(o) __weak typeof(o) o##Weak = o;
#define StrongObj(o) __strong typeof(o) o = o##Weak;

#define GoldGreenColor RGBHEXCOLOR(@"#5bb82e")
#define TextGrayColor RGBHEXCOLOR(@"#555555")
#define TextWithtGrayColor RGBHEXCOLOR(@"#e3e3e3")
#define BackGroudColor RGBHEXCOLOR(@"#1d1d1d")

#define BackGroudColor_Gray RGBHEXCOLOR(@"#f1f1f1")
#define TextColor_GrayLevel1 RGBHEXCOLOR(@"#999999")
#define TextColor_GrayLevel2 RGBHEXCOLOR(@"#666666")
#define TextColor_GrayLevel3 RGBHEXCOLOR(@"#333333") // 淡黑
#define IconBorder_Color RGBHEXCOLOR(@"#e3e3e3")
#define LINE_COLOR RGBHEXCOLOR(@"#bfbfbf") // 细线

#define AppConfigBroadcastPublishKey @"eb94cdc253e04ff7c358c38b2b041783"

//iOS版本
#define MF_Version_Greater_Or_Equal(a) ([[[UIDevice currentDevice] systemVersion] floatValue] >= a)

//通知处理
#define addN(_selector,_name)\
([[NSNotificationCenter defaultCenter] addObserver:self selector:_selector name:_name object:nil])

#define removeNObserverWithName(_name)\
([[NSNotificationCenter defaultCenter] removeObserver:self name:_name object:nil])

#define removeNObserver() ([[NSNotificationCenter defaultCenter] removeObserver:self])

#define postN(_name)\
([[NSNotificationCenter defaultCenter] postNotificationName:_name object:nil userInfo:nil])

#define postNWithObj(_name,_obj)\
([[NSNotificationCenter defaultCenter] postNotificationName:_name object:_obj userInfo:nil])

#define postNWithInfos(_name,_obj,_infos)\
([[NSNotificationCenter defaultCenter] postNotificationName:_name object:_obj userInfo:_infos])

#define DebugLog(s, ...) NSLog(@"%s(%d): %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])

#endif /* CommonMicro_h */
